#ifndef MAZEPROJECT_H
#define MAZEPROJECT_H

#include <QtGui/QMainWindow>
#include "ui_mazeproject.h"
#include"MazeProcess.h"
#include <qgraphicsscene.h>
#include<qgraphicsitem.h>
#include<qgraphicsview.h>
 #include <QFileDialog>
#include<vector>
#include<qprogressdialog.h>
#include<qstandarditemmodel.h>
#include<qpen.h>
#include<qpainter.h>
#include"Maze.h"
using namespace wangjincheng;
using namespace liandan;
class MazeProject : public QMainWindow
{
	Q_OBJECT

public:
	MazeProject(QWidget *parent = 0, Qt::WFlags flags = 0);
	
	
	
	
	void DrawMaze(QVector<QVector<cell>>Maze);
	
	int RunBlobTrackingAuto( CvCapture* pCap, CvBlobTrackerAuto* pTracker);
	int get_pos_track_from_video(CvCapture* pCap);
	bool check_jianrong(QVector<QVector<cell>> &mazedata,int now_row,int now_column,int check_row,int check_column);



	QString mazeleagal;
	QString searchpathleagal;
	double mazecoverrate;
	double seachmazerealmazehighrate;
	double searchshortestrate;
	double searchpathrepeat;
	double sideway;
    vector<double> mypoints_x;
    vector<double> mypoints_y;
	vector<double> my_times;
    double tot_f;
	int count;
	vector<int> res_column;
    vector<int> res_row;
	vector<double> res_time;

	vector<liandan::TrackNode> my_rush_tracknodes;
	vector<liandan::TrackNode> my_explore_tracknodes;

	vector<int> check_pre;
	vector<int> check_post;
	bool get_cell_track_from_data(
		QVector<QVector<cell>> &mazedata, 
		int maze_max_column,
		int maze_max_row,
		vector<double> car_x,
		vector<double> car_y,
		double cell_sizex,
		double cell_sizey,
		double start_x=0,
		double start_y=0);
	//QPointF startpoint;
	int startrowindex;
	int startcolindex;
	QGraphicsScene* scene;
	QGraphicsView* view;
	QString searchPath;
	QString rushPath;
	int row_no;
	int col_no;
	QProgressDialog process;
	QPainter* painter;
	~MazeProject();
	private slots:
		 void on_buttonStart_clicked();
		 void on_buttonImportSearch_clicked();
		 void on_buttonImportRush_clicked();
private:
	Ui::MazeProjectClass ui;
};

#endif // MAZEPROJECT_H
